package com.kly.user.enums;

/**
 * 在线状态
 * @author linqu
 */
public enum OnlineStatus {

    OTHER(0, "offline", "离线"),

    ONLINE_STATUS(1, "online", "在线"),

    OFFLINE_STATUS(2, "offline", "离线");

    private final int type;

    private final String Value;

    private final String description;


    OnlineStatus(int type, String value, String description) {
        this.type = type;
        Value = value;
        this.description = description;
    }

    public int getType() {
        return type;
    }

    public String getValue() {
        return Value;
    }

    public String getDescription() {
        return description;
    }


    public static OnlineStatus fromType(int type) {
        for (OnlineStatus userStatus : values()) {
            if (userStatus.getType() == type) {
                return userStatus;
            }
        }
        throw new IllegalArgumentException("Invalid login type: " + type);
    }
}
